import request from '@/utils/request.js'
import store from '@/store'
import config from '@/utils/config.js'

/**
 * 获取用户基本信息
 */
export function getUserInfoByName(username) {
	const params = {
		username
	}
	return request.post({
		url: '/oauth2/v3/user/context',
		params
	});
}

/**
 * 获取首页公告
 */
export function getNews() {
	return request.get({
		url: '/platform/v3/desktop/facade/getNews'
	});
}

/**
 * 获取公告列表
 */
export function getNoticeList(pager, params) {
	return request.post({
		url: '/platform/v3/system/news/query',
		pager,
		params,
		type: 1
	});
}

/**
 * 获取公告详情
 */
export function getNoticeDetail(noticeId) {
	const params = {
		newsId: noticeId
	}
	return request.get({
		url: '/platform/v3/system/news/get',
		params
	});
}

/**
 * 获取附件信息
 */
export function getAttachment(attachmentIds) {
	const params = {
		ids: attachmentIds
	}
	return request.post({
		url: '/platform/v3/file/attachment/transfer',
		params
	});
}

/**
 * 获取未读消息
 */
export function getMsgList() {
	return request.get({
		url: '/platform/v3/msg/innerMessage/msgList'
	});
}

/**
 * 获取业务应用
 */
export function getAppResource() {
	return request.get({
		url: '/platform/v3/auth/appres/getMenuData'
	});
}

/**
 * 获取用户全部信息
 */
export function getUserInfo() {
	const params = {
		employeeId: store.getters['user/userId']
	}
	return request.get({
		url: '/platform/v3/employee/load',
		params
	});
}

/**
 * 修改密码
 */
export function modifyPassword(params) {
	return request.post({
		url: '/platform/v3/user/change/passwd',
		params
	});
}
/**
 * 场站列表
 */
export function stationList(params) {
	return request.post({
		url: config.baseUrl + '/business/v3/data/template/queryDataByKey',
		params
	})
}